<template>
  <!-- 基于 Element UI 新增和修改弹窗 -->
    <a-drawer
            :title="!dataForm.imgid ? '添加' : '修改'"
            :visible="visible"
            @close="cancel"
            :body-style="{ paddingBottom: '80px' }"
            :width="750"
    >
    <!-- 新增和创建表单表单 -->
    <el-form :model="dataForm" :rules="dataRule"  v-loading="loading" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="80px" style="padding: 0px 10px;margin: 0px 10px">
    <el-form-item label="应用名称" prop="softwarename">
      <el-input v-model="dataForm.softwarename" placeholder="标题" size="small"></el-input>
    </el-form-item>
    <el-form-item label="副标题" >
      <el-input v-model="dataForm.softwaremsg" placeholder="副标题" size="small"></el-input>
    </el-form-item>
      <el-form-item label="游戏类型" >

        <el-select v-model="dataForm.gametype" placeholder="请选择" class="selWidth" filterable>
          <el-option
            v-for="item in softwareCategoryList"
            :label="item.name"
            :key="item.id"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="logo" prop="logo">
        <upload-img text="logo" :fileListValue="dataForm.softwarepath" v-model="dataForm.softwarepath" style="margin-bottom: -30px"></upload-img>
      </el-form-item>

      <el-form-item label="展示图" >
        <el-radio-group  v-model="dataForm.isWeightImg" size="small">
          <el-radio-button  label="0" >竖版</el-radio-button>
          <el-radio-button  label="1" >横版</el-radio-button>
        </el-radio-group>

<!--        <el-radio-group v-model="tableForm.payState" type="button" @change="changeState(1)">-->
<!--          <el-radio-button label="-1">全部 </el-radio-button>-->
<!--          <el-radio-button label="0">等待支付 </el-radio-button>-->
<!--          <el-radio-button label="1">支付完成 </el-radio-button>-->
<!--          <el-radio-button label="2">交易取消 </el-radio-button>-->
<!--          &lt;!&ndash;                <el-radio-button label="-2">已退款 </el-radio-button>&ndash;&gt;-->
<!--        </el-radio-group>-->
<!--        -->
        <upload-img text="上传" :fileListValue="dataForm.infoimg" v-model="dataForm.infoimg" :max-length="5" :content="{'compress':true}" :isMultiple="true"   style="margin-top: 15px;margin-bottom: -30px"></upload-img>
      </el-form-item>
      <el-form-item label="官网" >
        <el-input v-model="dataForm.officialwebsiteaddress" placeholder="官网" size="small"></el-input>
      </el-form-item>
      <el-form-item label="关键词" >
        <el-input type="textarea" v-model="dataForm.keywords" placeholder="关键词" size="small"></el-input>
      </el-form-item>


      <el-form-item label="介绍" >
        <el-input type="textarea" v-model="dataForm.applyintroduce" placeholder="介绍" size="small"></el-input>
      </el-form-item>
      <el-form-item label="软件地址" style="margin-top: -20px; ">
        <el-input v-model="dataForm.iosuploadaddress" placeholder="地址" size="small"></el-input>
      </el-form-item>

      <el-form-item label="软件信息" >
        <el-input v-model="dataForm.packagename" placeholder="包名" size="small" style="width:200px"></el-input>
        <el-input v-model="dataForm.softwareiosstart" placeholder="版本" size="small" style="width:100px"></el-input>
        <el-input v-model="dataForm.iosapplysize" placeholder="包大小" size="small" style="width:100px"></el-input>
      </el-form-item>

<!--      <el-card style="height: 100px;margin-top:-10px ">-->
<!--        <div class="title" style="height: 45px">-->
<!--          <span style="font-weight: bold">IOS信息</span>-->
<!--        </div>-->
<!--        <a-descriptions  style="margin-top:-10px " :column="20">-->
<!--          <a-descriptions-item label="" :span="4"><el-input v-model="dataForm.softwareiosstart" placeholder="版本" size="small"/></a-descriptions-item>-->
<!--          <a-descriptions-item label="" :span="4"> <el-input v-model="dataForm.iosapplysize" placeholder="包大小" size="small"/></a-descriptions-item>-->
<!--          <a-descriptions-item label="" :span="12"><el-input v-model="dataForm.iosuploadaddress" placeholder="下载地址" size="small" style="width:305px"/></a-descriptions-item>-->
<!--        </a-descriptions>-->
<!--      </el-card>-->

<!--      <el-form-item label="下载次数" >-->
<!--        <el-input v-model="dataForm.downloadnum" placeholder="下载次数" size="small"></el-input>-->
<!--      </el-form-item>-->
      <el-form-item label="虚拟评分"  style="width: 200px;display: inline-block">
<!--        <el-input type="number" v-model="dataForm.scorex" placeholder="虚拟评分" size="small" max="50"></el-input>-->
        <el-input-number v-model="dataForm.scorex" controls-position="right" placeholder="虚拟评分"  :min="0" :max="50" style="width:150px"></el-input-number>

      </el-form-item>
      <el-form-item label="虚拟下载量" style="width: 200px; display: inline-block;margin-left: 50px" label-width="100px">
        <el-input type="number" v-model="dataForm.downloadnumx" placeholder="虚拟下载量" size="small" style="width:150px"></el-input>
      </el-form-item>





<!--    <el-form-item label="ios软件文件路径" >-->
<!--      <el-input v-model="dataForm.softwareiosfilepath" placeholder="ios软件文件路径" size="small"></el-input>-->
<!--    </el-form-item>-->

<!--    <el-form-item label="安卓的软件文件路径" >-->
<!--      <el-input v-model="dataForm.softwarefilepath" placeholder="安卓的软件文件路径" size="small"></el-input>-->
<!--    </el-form-item>-->

<!--    <el-form-item label="软件状态(1未下架,2已下架)" >-->
<!--      <el-input v-model="dataForm.softwarestatus" placeholder="软件状态(1未下架,2已下架)" size="small"></el-input>-->
<!--    </el-form-item>-->

<!--    <el-form-item label="应用大小" >-->
<!--      <el-input v-model="dataForm.applysize" placeholder="应用大小" size="small"></el-input>-->
<!--    </el-form-item>-->

    <el-form-item label="福利内容" >
      <el-input  type="textarea" v-model="dataForm.welfarecontent" placeholder="福利" size="small"></el-input>
    </el-form-item>
      <el-form-item label="来源" >
        <el-input v-model="dataForm.source" placeholder="来源" size="small"></el-input>
      </el-form-item>

<!--    <el-form-item label="主要功能" >-->
<!--      <el-input v-model="dataForm.majorfunction" placeholder="主要功能" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="其他功能" >-->
<!--      <el-input v-model="dataForm.otherfunction" placeholder="其他功能" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="糖果数量" >-->
<!--      <el-input v-model="dataForm.candynum" placeholder="糖果数量" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="精品游戏(1-8)" >-->
<!--      <el-input v-model="dataForm.hot" placeholder="精品游戏(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="入门必备(1-8)" >-->
<!--      <el-input v-model="dataForm.accidence" placeholder="入门必备(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="是否推荐(1推荐-2不推荐)" >-->
<!--      <el-input v-model="dataForm.priority" placeholder="是否推荐(1推荐-2不推荐)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="访问量" >-->
<!--      <el-input v-model="dataForm.visitnum" placeholder="访问量" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="每日访问量" >-->
<!--      <el-input v-model="dataForm.visitdaynum" placeholder="每日访问量" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="app名称" >-->
<!--      <el-input v-model="dataForm.appname" placeholder="app名称" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="初始版本上传时间" >-->
<!--      <el-input v-model="dataForm.starttime" placeholder="初始版本上传时间" size="small"></el-input>-->
<!--    </el-form-item>-->



<!--    <el-form-item label="小编推荐(1-8)" >-->
<!--      <el-input v-model="dataForm.smallweavepriority" placeholder="小编推荐(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="排行榜推荐(1-8)" >-->
<!--      <el-input v-model="dataForm.prioritysort" placeholder="排行榜推荐(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="首页热门交易所(1-8)" >-->
<!--      <el-input v-model="dataForm.priority1" placeholder="首页热门交易所(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="首页主流钱包(1-8)" >-->
<!--      <el-input v-model="dataForm.prioritywallet" placeholder="首页主流钱包(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="首页行情资讯推荐(1-8)" >-->
<!--      <el-input v-model="dataForm.priority2" placeholder="首页行情资讯推荐(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="应用工具(1-8)" >-->
<!--      <el-input v-model="dataForm.priority3" placeholder="应用工具(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="首页出众新锐(1-8)" >-->
<!--      <el-input v-model="dataForm.priority4" placeholder="首页出众新锐(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="区块链浏览器(1-8)" >-->
<!--      <el-input v-model="dataForm.priority5" placeholder="区块链浏览器(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="首页区块链游戏(1-8)" >-->
<!--      <el-input v-model="dataForm.priority6" placeholder="首页区块链游戏(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="EOS专区热门推荐(1-8)" >-->
<!--      <el-input v-model="dataForm.priority7" placeholder="EOS专区热门推荐(1-8)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="游戏分类配置-热门游戏" >-->
<!--      <el-input v-model="dataForm.priority8" placeholder="游戏分类配置-热门游戏" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="游戏分类配置-最新游戏" >-->
<!--      <el-input v-model="dataForm.priority9" placeholder="游戏分类配置-最新游戏" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="游戏分类配置-经典回顾" >-->
<!--      <el-input v-model="dataForm.priority10" placeholder="游戏分类配置-经典回顾" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="游戏分类配置-推荐游戏" >-->
<!--      <el-input v-model="dataForm.priority11" placeholder="游戏分类配置-推荐游戏" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="是否热门搜索(1否,2是)" >-->
<!--      <el-input v-model="dataForm.hotsearch" placeholder="是否热门搜索(1否,2是)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--   -->
<!--    <el-form-item label="应用的BT版本标识：1未设置、2Android已设置、3IOS已设置、4都已设置" >-->
<!--      <el-input v-model="dataForm.btversionstatus" placeholder="应用的BT版本标识：1未设置、2Android已设置、3IOS已设置、4都已设置" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="下载量限制" >-->
<!--      <el-input v-model="dataForm.downloadlimit" placeholder="下载量限制" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="下载量统计" >-->
<!--      <el-input v-model="dataForm.downloadcount" placeholder="下载量统计" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="关键词热度" >-->
<!--      <el-input v-model="dataForm.wordsheat" placeholder="关键词热度" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="检索热度" >-->
<!--      <el-input v-model="dataForm.searchheat" placeholder="检索热度" size="small"></el-input>-->
<!--    </el-form-item>-->


<!--    <el-form-item label="开发者(user_entity)编号" >-->
<!--      <el-input v-model="dataForm.developerid" placeholder="开发者(user_entity)编号" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--   -->
<!--    <el-form-item label="应用权限获取说明" >-->
<!--      <el-input v-model="dataForm.apppermission" placeholder="应用权限获取说明" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="收费类型：1免费、2收费、3部分功能收费、4部分内容收费" >-->
<!--      <el-input v-model="dataForm.chargetype" placeholder="收费类型：1免费、2收费、3部分功能收费、4部分内容收费" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="广告状态：1无广告、2含广告、3内嵌广告、4通知栏广告" >-->
<!--      <el-input v-model="dataForm.adstatus" placeholder="广告状态：1无广告、2含广告、3内嵌广告、4通知栏广告" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="支持语言：1简体中文、2繁体中文、3英文、4其它" >-->
<!--      <el-input v-model="dataForm.languetype" placeholder="支持语言：1简体中文、2繁体中文、3英文、4其它" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="电子版权认证证书(安卓)" >-->
<!--      <el-input v-model="dataForm.copyrightandroid" placeholder="电子版权认证证书(安卓)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="证明材料(安卓)" >-->
<!--      <el-input v-model="dataForm.proveandroid" placeholder="证明材料(安卓)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="安全评估报告(安卓)" >-->
<!--      <el-input v-model="dataForm.reportandroid" placeholder="安全评估报告(安卓)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="URL schema(iphone)" >-->
<!--      <el-input v-model="dataForm.urlschemaiphone" placeholder="URL schema(iphone)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="AppStoreId(iphone)" >-->
<!--      <el-input v-model="dataForm.appstoreidiphone" placeholder="AppStoreId(iphone)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="bundle id(iphone)" >-->
<!--      <el-input v-model="dataForm.bundleidiphone" placeholder="bundle id(iphone)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="URL schema(ipad)" >-->
<!--      <el-input v-model="dataForm.urlschemaipad" placeholder="URL schema(ipad)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="AppStoreId(ipad)" >-->
<!--      <el-input v-model="dataForm.appstoreidipad" placeholder="AppStoreId(ipad)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="bundle id(ipad)" >-->
<!--      <el-input v-model="dataForm.bundleidipad" placeholder="bundle id(ipad)" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="应用审核时间" >-->
<!--      <el-input v-model="dataForm.checktime" placeholder="应用审核时间" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="应用审核描述" >-->
<!--      <el-input v-model="dataForm.checkmessage" placeholder="应用审核描述" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="应用的用户评分" >-->
<!--      <el-input v-model="dataForm.commentscore" placeholder="应用的用户评分" size="small"></el-input>-->
<!--    </el-form-item>-->

<!--    <el-form-item label="应用的短视频介绍" >-->
<!--      <el-input v-model="dataForm.videourl" placeholder="应用的短视频介绍" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="应用的PC端详情页链接地址" >-->
<!--      <el-input v-model="dataForm.pageinfourl" placeholder="应用的PC端详情页链接地址" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="应用的PC端详情页状态：1未生成、2已生成" >-->
<!--      <el-input v-model="dataForm.pageinfostatus" placeholder="应用的PC端详情页状态：1未生成、2已生成" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="应用的PC端详情页生成时间" >-->
<!--      <el-input v-model="dataForm.pageinfotime" placeholder="应用的PC端详情页生成时间" size="small"></el-input>-->
<!--    </el-form-item>-->
<!--    <el-form-item label="评分" >-->
<!--      <el-input v-model="dataForm.score" placeholder="评分" size="small"></el-input>-->
<!--    </el-form-item>-->

    </el-form>
        <div :style="{position: 'absolute',right: 0,bottom: 0,width: '100%', borderTop: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',textAlign: 'right',zIndex: 1,}">
            <el-button @click="cancel()" :style="{ marginRight: '8px' }">取消</el-button>
            <el-button type="primary" @click="submit()">确定</el-button>
        </div>
  </a-drawer>
</template>

<script>
    import api from '@/api/api'
    import uploadImg from '@/components/Upload/uploadImg'
    import uploadFile from '@/components/Upload/uploadFile'

    export default {
    components: {
      uploadImg,uploadFile
    },
    data () {
      return {
        visible: false,
        loading:false,
        softwareCategoryList:[],
        dataForm: {
          android:{fileUrl:'',fileSize:''},
          softwareid: 0,
          source:'',
          createtime: '' ,
          modifytime: '' ,
          modifytime1: '' ,
          softwarename: '' ,
          downloadnum: '' ,
          downloadnumx: '' ,
          softwaremsg: '' ,
          softwarepath: '' ,
          softwareforeignkey: '' ,
          softwareiosfilepath: '' ,
          softwareiosstart: '' ,
          softwarefilepath: '' ,
          softwarestart: '' ,
          softwarestatus: '' ,
          softwaretype: 2 ,
          gametype: '' ,
          applysize: '' ,
          applyintroduce: '' ,
          welfarecontent: '' ,
          majorfunction: '' ,
          otherfunction: '' ,
          candynum: '' ,
          hot: '' ,
          accidence: '' ,
          priority: '' ,
          visitnum: '' ,
          visitdaynum: '' ,
          appname: '' ,
          starttime: '' ,
          isWeightImg:1,
          infoimg:'',
          infoimg1: '' ,
          infoimg2: '' ,
          infoimg3: '' ,
          infoimg4: '' ,
          infoimg5: '' ,
          infoimg1long: '' ,
          infoimg2long: '' ,
          infoimg3long: '' ,
          infoimg4long: '' ,
          infoimg5long: '' ,
          officialwebsiteaddress: '' ,
          iosapplysize: '' ,
          iosuploadaddress: '' ,
          androiduploadaddress: '' ,
          h5address: '' ,
          androidappsize: '' ,
          smallweavepriority: '' ,
          prioritysort: '' ,
          priority1: '' ,
          prioritywallet: '' ,
          priority2: '' ,
          priority3: '' ,
          priority4: '' ,
          priority5: '' ,
          priority6: '' ,
          priority7: '' ,
          priority8: '' ,
          priority9: '' ,
          priority10: '' ,
          priority11: '' ,
          hotsearch: '' ,
          keywords: '' ,
          btversionstatus: '' ,
          downloadlimit: '' ,
          downloadcount: '' ,
          wordsheat: '' ,
          searchheat: '' ,
          packagename: '' ,
          developerid: '' ,
          appsign: '' ,
          apppermission: '' ,
          chargetype: '' ,
          adstatus: '' ,
          languetype: '' ,
          copyrightandroid: '' ,
          proveandroid: '' ,
          reportandroid: '' ,
          urlschemaiphone: '' ,
          appstoreidiphone: '' ,
          bundleidiphone: '' ,
          urlschemaipad: '' ,
          appstoreidipad: '' ,
          bundleidipad: '' ,
          checktime: '' ,
          checkmessage: '' ,
          commentscore: '' ,
          versionno: '' ,
          videourl: '' ,
          pageinfourl: '' ,
          pageinfostatus: '' ,
          pageinfotime: '' ,
          score: '' ,
          scorex: ''
        },
        dataRule: {
          createtime: [
            { required: true, message: '创建时间  为必填项', trigger: 'blur' }
          ],
          modifytime: [
            { required: true, message: '修改时间  为必填项', trigger: 'blur' }
          ],
          modifytime1: [
            { required: true, message: '后台配置的软件修改时间  为必填项', trigger: 'blur' }
          ],
          softwarename: [
            { required: true, message: '软件名称  为必填项', trigger: 'blur' }
          ],
          downloadnum: [
            { required: true, message: '下载次数  为必填项', trigger: 'blur' }
          ],
          downloadnumx: [
            { required: true, message: '虚拟下载量  为必填项', trigger: 'blur' }
          ],
          softwaremsg: [
            { required: true, message: '副标题  为必填项', trigger: 'blur' }
          ],
          softwarepath: [
            { required: true, message: '软件展示图  为必填项', trigger: 'blur' }
          ],
          softwareforeignkey: [
            { required: true, message: '软件图片外键  为必填项', trigger: 'blur' }
          ],
          softwareiosfilepath: [
            { required: true, message: 'ios软件文件路径  为必填项', trigger: 'blur' }
          ],
          softwareiosstart: [
            { required: true, message: 'ios的版本  为必填项', trigger: 'blur' }
          ],
          softwarefilepath: [
            { required: true, message: '安卓的软件文件路径  为必填项', trigger: 'blur' }
          ],
          softwarestart: [
            { required: true, message: '安卓的版本  为必填项', trigger: 'blur' }
          ],
          softwarestatus: [
            { required: true, message: '软件状态(1未下架,2已下架)  为必填项', trigger: 'blur' }
          ],
          softwaretype: [
            { required: true, message: '软件类型为必填项', trigger: 'blur' }
          ],
          gametype: [
            { required: true, message: '游戏类型(1,策略,2抽卡,3养成,4战斗)  为必填项', trigger: 'blur' }
          ],
          applysize: [
            { required: true, message: '应用大小  为必填项', trigger: 'blur' }
          ],
          applyintroduce: [
            { required: true, message: '应用介绍  为必填项', trigger: 'blur' }
          ],
          welfarecontent: [
            { required: true, message: '福利  为必填项', trigger: 'blur' }
          ],
          majorfunction: [
            { required: true, message: '主要功能  为必填项', trigger: 'blur' }
          ],
          otherfunction: [
            { required: true, message: '其他功能  为必填项', trigger: 'blur' }
          ],
          candynum: [
            { required: true, message: '糖果数量  为必填项', trigger: 'blur' }
          ],
          hot: [
            { required: true, message: '精品游戏(1-8)  为必填项', trigger: 'blur' }
          ],
          accidence: [
            { required: true, message: '入门必备(1-8)  为必填项', trigger: 'blur' }
          ],
          priority: [
            { required: true, message: '是否推荐(1推荐-2不推荐)  为必填项', trigger: 'blur' }
          ],
          visitnum: [
            { required: true, message: '访问量  为必填项', trigger: 'blur' }
          ],
          visitdaynum: [
            { required: true, message: '每日访问量  为必填项', trigger: 'blur' }
          ],
          appname: [
            { required: true, message: 'app名称  为必填项', trigger: 'blur' }
          ],
          starttime: [
            { required: true, message: '初始版本上传时间  为必填项', trigger: 'blur' }
          ],
          infoimg1: [
            { required: true, message: '详情图1  为必填项', trigger: 'blur' }
          ],
          infoimg2: [
            { required: true, message: '详情图2  为必填项', trigger: 'blur' }
          ],
          infoimg3: [
            { required: true, message: '详情图3  为必填项', trigger: 'blur' }
          ],
          infoimg4: [
            { required: true, message: '详情图4  为必填项', trigger: 'blur' }
          ],
          infoimg5: [
            { required: true, message: '详情图5  为必填项', trigger: 'blur' }
          ],
          infoimg1long: [
            { required: true, message: '  为必填项', trigger: 'blur' }
          ],
          infoimg2long: [
            { required: true, message: '  为必填项', trigger: 'blur' }
          ],
          infoimg3long: [
            { required: true, message: '  为必填项', trigger: 'blur' }
          ],
          infoimg4long: [
            { required: true, message: '  为必填项', trigger: 'blur' }
          ],
          infoimg5long: [
            { required: true, message: '  为必填项', trigger: 'blur' }
          ],
          officialwebsiteaddress: [
            { required: true, message: '官网  为必填项', trigger: 'blur' }
          ],
          iosapplysize: [
            { required: true, message: 'ios包大小  为必填项', trigger: 'blur' }
          ],
          iosuploadaddress: [
            { required: true, message: 'ISO下载地址  为必填项', trigger: 'blur' }
          ],
          androiduploadaddress: [
            { required: true, message: '安卓下载地址  为必填项', trigger: 'blur' }
          ],
          h5address: [
            { required: true, message: '云玩地址  为必填项', trigger: 'blur' }
          ],
          androidappsize: [
            { required: true, message: '安卓包大小  为必填项', trigger: 'blur' }
          ],
          smallweavepriority: [
            { required: true, message: '小编推荐(1-8)  为必填项', trigger: 'blur' }
          ],
          prioritysort: [
            { required: true, message: '排行榜推荐(1-8)  为必填项', trigger: 'blur' }
          ],
          priority1: [
            { required: true, message: '首页热门交易所(1-8)  为必填项', trigger: 'blur' }
          ],
          prioritywallet: [
            { required: true, message: '首页主流钱包(1-8)  为必填项', trigger: 'blur' }
          ],
          priority2: [
            { required: true, message: '首页行情资讯推荐(1-8)  为必填项', trigger: 'blur' }
          ],
          priority3: [
            { required: true, message: '应用工具(1-8)  为必填项', trigger: 'blur' }
          ],
          priority4: [
            { required: true, message: '首页出众新锐(1-8)  为必填项', trigger: 'blur' }
          ],
          priority5: [
            { required: true, message: '区块链浏览器(1-8)  为必填项', trigger: 'blur' }
          ],
          priority6: [
            { required: true, message: '首页区块链游戏(1-8)  为必填项', trigger: 'blur' }
          ],
          priority7: [
            { required: true, message: 'EOS专区热门推荐(1-8)  为必填项', trigger: 'blur' }
          ],
          priority8: [
            { required: true, message: '游戏分类配置-热门游戏  为必填项', trigger: 'blur' }
          ],
          priority9: [
            { required: true, message: '游戏分类配置-最新游戏  为必填项', trigger: 'blur' }
          ],
          priority10: [
            { required: true, message: '游戏分类配置-经典回顾  为必填项', trigger: 'blur' }
          ],
          priority11: [
            { required: true, message: '游戏分类配置-推荐游戏  为必填项', trigger: 'blur' }
          ],
          hotsearch: [
            { required: true, message: '是否热门搜索(1否,2是)  为必填项', trigger: 'blur' }
          ],
          keywords: [
            { required: true, message: '关键字  为必填项', trigger: 'blur' }
          ],
          btversionstatus: [
            { required: true, message: '应用的BT版本标识：1未设置、2Android已设置、3IOS已设置、4都已设置  为必填项', trigger: 'blur' }
          ],
          downloadlimit: [
            { required: true, message: '下载量限制  为必填项', trigger: 'blur' }
          ],
          downloadcount: [
            { required: true, message: '下载量统计  为必填项', trigger: 'blur' }
          ],
          wordsheat: [
            { required: true, message: '关键词热度  为必填项', trigger: 'blur' }
          ],
          searchheat: [
            { required: true, message: '检索热度  为必填项', trigger: 'blur' }
          ],
          packagename: [
            { required: true, message: '应用包名  为必填项', trigger: 'blur' }
          ],
          developerid: [
            { required: true, message: '开发者(user_entity)编号  为必填项', trigger: 'blur' }
          ],
          appsign: [
            { required: true, message: '应用签名  为必填项', trigger: 'blur' }
          ],
          apppermission: [
            { required: true, message: '应用权限获取说明  为必填项', trigger: 'blur' }
          ],
          chargetype: [
            { required: true, message: '收费类型：1免费、2收费、3部分功能收费、4部分内容收费  为必填项', trigger: 'blur' }
          ],
          adstatus: [
            { required: true, message: '广告状态：1无广告、2含广告、3内嵌广告、4通知栏广告  为必填项', trigger: 'blur' }
          ],
          languetype: [
            { required: true, message: '支持语言：1简体中文、2繁体中文、3英文、4其它  为必填项', trigger: 'blur' }
          ],
          copyrightandroid: [
            { required: true, message: '电子版权认证证书(安卓)  为必填项', trigger: 'blur' }
          ],
          proveandroid: [
            { required: true, message: '证明材料(安卓)  为必填项', trigger: 'blur' }
          ],
          reportandroid: [
            { required: true, message: '安全评估报告(安卓)  为必填项', trigger: 'blur' }
          ],
          urlschemaiphone: [
            { required: true, message: 'URL schema(iphone)  为必填项', trigger: 'blur' }
          ],
          appstoreidiphone: [
            { required: true, message: 'AppStoreId(iphone)  为必填项', trigger: 'blur' }
          ],
          bundleidiphone: [
            { required: true, message: 'bundle id(iphone)  为必填项', trigger: 'blur' }
          ],
          urlschemaipad: [
            { required: true, message: 'URL schema(ipad)  为必填项', trigger: 'blur' }
          ],
          appstoreidipad: [
            { required: true, message: 'AppStoreId(ipad)  为必填项', trigger: 'blur' }
          ],
          bundleidipad: [
            { required: true, message: 'bundle id(ipad)  为必填项', trigger: 'blur' }
          ],
          checktime: [
            { required: true, message: '应用审核时间  为必填项', trigger: 'blur' }
          ],
          checkmessage: [
            { required: true, message: '应用审核描述  为必填项', trigger: 'blur' }
          ],
          commentscore: [
            { required: true, message: '应用的用户评分  为必填项', trigger: 'blur' }
          ],
          versionno: [
            { required: true, message: 'Android版本号  为必填项', trigger: 'blur' }
          ],
          videourl: [
            { required: true, message: '应用的短视频介绍  为必填项', trigger: 'blur' }
          ],
          pageinfourl: [
            { required: true, message: '应用的PC端详情页链接地址  为必填项', trigger: 'blur' }
          ],
          pageinfostatus: [
            { required: true, message: '应用的PC端详情页状态：1未生成、2已生成  为必填项', trigger: 'blur' }
          ],
          pageinfotime: [
            { required: true, message: '应用的PC端详情页生成时间  为必填项', trigger: 'blur' }
          ],
          score: [
            { required: true, message: '评分  为必填项', trigger: 'blur' }
          ],
          scorex: [
            { required: true, message: '虚拟评分  为必填项', trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      init (id) {
        this.getSoftwareCategoryList()
        // 初始化表单验证规则
        this.dataForm.softwareid = id || undefined
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.softwareid){
              this.loading = true
                api.post('rest/vabc/softwareEntity/info',{softwareid:this.dataForm.softwareid}).then(res => {
                  Object.assign(this.dataForm, res)
                 // console.error("this.dataForm.infoimg1long",this.dataForm.infoimg1long,this.dataForm.infoimg1long.length)
                  if (this.dataForm.infoimg1long.length>=1){
                  this.dataForm.isWeightImg=1;
                }else {
                    this.dataForm.isWeightImg=0;
                  }
                  this.getImgInfo();
                  this.getAndroid();
            }).finally(() => {
                this.loading = false
            });
          }
        })
      },getAndroid(){
        this.dataForm.android.fileSize= this.dataForm.androidappsize;
        this.dataForm.android.fileUrl=this.dataForm.androiduploadaddress;
      },
      setAndroid(){
        if (this.dataForm.android.fileUrl){
          this.dataForm.androiduploadaddress=this.dataForm.android.fileUrl;
        }
        if (this.dataForm.android.fileSize){
          this.dataForm.androidappsize=this.dataForm.android.fileSize;
        }
      },
      getImgInfo(){
        let infoimgNew=''
        if(this.dataForm.isWeightImg==1){
          if (this.dataForm.infoimg1long.length>0){infoimgNew+=this.dataForm.infoimg1long}
          if (this.dataForm.infoimg2long.length>0){infoimgNew+=","+this.dataForm.infoimg2long}
          if (this.dataForm.infoimg3long.length>0){infoimgNew+=","+this.dataForm.infoimg3long}
          if (this.dataForm.infoimg4long.length>0){infoimgNew+=","+this.dataForm.infoimg4long}
          if (this.dataForm.infoimg5long.length>0){infoimgNew+=","+this.dataForm.infoimg5long}
        }else {
          if (this.dataForm.infoimg1.length>0){infoimgNew+=this.dataForm.infoimg1}
          if (this.dataForm.infoimg2.length>0){infoimgNew+=","+this.dataForm.infoimg2}
          if (this.dataForm.infoimg3.length>0){infoimgNew+=","+this.dataForm.infoimg3}
          if (this.dataForm.infoimg4.length>0){infoimgNew+=","+this.dataForm.infoimg4}
          if (this.dataForm.infoimg5.length>0){infoimgNew+=","+this.dataForm.infoimg5}
        }
        this.dataForm.infoimg=infoimgNew;
      }, setImgInfo: function() {
        let infoimgNew = this.dataForm.infoimg
        let index=1;
          for (const string of infoimgNew.split(',')) {
            if (this.dataForm.isWeightImg==1) {
              if (index == 1) {this.dataForm.infoimg1long = string;this.dataForm.infoimg1 = ''
              } else if (index == 2) {this.dataForm.infoimg2long = string;this.dataForm.infoimg2 = ''
              } else if (index == 3) {this.dataForm.infoimg3long = string;this.dataForm.infoimg3 = ''
              } else if (index == 4) {this.dataForm.infoimg4long = string;this.dataForm.infoimg4 = ''
              } else if (index == 5) {this.dataForm.infoimg5long = string;this.dataForm.infoimg5 = ''
              }
            }else{
              if (index == 1) {this.dataForm.infoimg1 = string;this.dataForm.infoimg1long = ''
              } else if (index == 2) {this.dataForm.infoimg2 = string;this.dataForm.infoimg2long = ''
              } else if (index == 3) {this.dataForm.infoimg3 = string;this.dataForm.infoimg3long = ''
              } else if (index == 4) {this.dataForm.infoimg4 = string;this.dataForm.infoimg4long = ''
              } else if (index == 5) {this.dataForm.infoimg5 = string;this.dataForm.infoimg5long = ''
              }
            }
            index++;
          }
        },
      // 表单数据提交
      submit () {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            this.loading = true
            this.setImgInfo();
            this.setAndroid();
            let postData=Object.assign({},this.dataForm)
            postData.createtime=undefined
            postData.modifytime=undefined
            postData.modifytime1=undefined
            postData.checktime=undefined
            postData.pageinfotime=undefined
            if (!this.dataForm.softwareid){
                postData.softwareid==undefined
                api.post('rest/vabc/softwareEntity/save',postData).then(res =>{
                    this.$message.success("创建成功")
                    this.reset()
                  this.visible = false
                  this.$parent.getDataList()
                }).finally(() => {
                  this.loading = false

                });
            }else{
                api.post('rest/vabc/softwareEntity/update',postData).then(res =>{
                    this.$message.success("保存成功")
                    this.reset()
                  this.visible = false

                    this.$parent.getDataList()
                }).finally(() => {
                  this.loading = false

                });
            }
          }
        })
      },
     cancel(){
        this.visible = false
        this.reset()
    },
    reset(){
        this.$refs.dataForm.resetFields()
        this.$data.dataForm=JSON.parse(JSON.stringify(this.$options.data().dataForm))
        //this.$data.dataForm.isWeightImg=1
        //图片回写
        //this.$refs["childData"].fileList=[]
    },
      getSoftwareCategoryList () {
        let postData={
          'order':'desc',
          'column':'sortnum,updatetime',
          'pageSize':1000,
          'pageIndex':1,
          'status':1
        }
        //postData.key=postData.key.length==0?postData.key:'%'+postData.key+'%'
        api.post('rest/vabc/softwarecategory/list',postData).then(res => {
          this.softwareCategoryList=res.datalist
        }).finally(() => {
        });
      },
    }
  }
</script>
